package com.foosun.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * entity基类.
 * 
 * 
 */
public class BaseEntity {
	protected Integer id;
	protected boolean visible = true;
	protected Date insertTime = new Date();
	protected Date lastUpdateTime = new Date();

	public Map<String, Object> getEntityMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("visible", true);
		map.put("insert_time", insertTime);
		map.put("last_update_time", lastUpdateTime);
		return map;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public Date getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(Date lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}

	/**
	 * 是否是新对象
	 * 
	 * @return
	 */
	public boolean isNew() {
		return (this.id == null);
	}

}
